<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
		<meta name="apple-mobile-web-app-capable" content="yes"/>
		<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
		<link rel="stylesheet" type="text/css" href="../css/mui.min.css"/>
		<link rel="stylesheet" type="text/css" href="../css/font-awesome.min.css"/>
		<style type="text/css">
			body{
				background:#FFFFCC;
				color:  black;
			}
			.ui-ordermation{
				padding: 2% 5%;
				/*background-color: orangered;*/
				border: 1px solid darkorange;
				/*border-radius: 10px;*/
			}
			.ui-icon{
				height: 100%;
				color: blanchedalmond;
			}
			.ui-order{
				padding-left: 20%;
				font-size: 14px;
				font-weight: 400;
			}
			.ui-receive{
				padding: 5% 5%;
				background-color: plum;
				margin: 2% 0;
				border: 2px solid coral;
				/*border-radius: 10px;*/
			}
			.ui-orderdetail{
				border: 2px solid mediumpurple;
				/*border-radius: 5px;*/
			}
			.mui-table-view-cell:before{
				left: 0;
				background-color: mediumpurple;
			}
			.mui-table-view-cell:after{
				left: 0;
				background-color: mediumpurple;
			}
			.ui-good{
				padding: 1% 1%;
				display: block;
			}
			.ui-logo{
				width: 60px;
				height: 60px;
			}
			.ui-fee{
				color: black;
			}
		</style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav ">
			<span class="mui-icon mui-icon-back mui-pull-left" onclick="back()"></span>
			<h5 class="mui-title">订单详情</h5>
		</header>
		<div class="mui-content mui-scroll-wrapper">
			<div class="mui-scroll" style="padding:0 0;">
				<div class="ui-ordermation">
					<p class="mui-icon FontAwesome icon-file-alt mui-pull-left ui-icon icon-2x"></p>
					<p class="ui-order">订单编号：<span id="ordersn"></span></p>
					<p class="ui-order">订单状态：<span id="orderstatus"></span></p>
					<p class="ui-order">订单金额(含运费):<span id="orderprice"></span></p>
					<p class="ui-order">运费:¥ <span id="orderdisprice"></span></p>
				</div>
				<div class="ui-receive">
					<p class="mui-icon mui-icon-location ui-icon mui-pull-left"></p>
					<p class="ui-order">收件人: <span id="toWho"></span></p>
					<p class="ui-order">联系电话: <span id="callWhat"></span></p>
					<p class="ui-order toWhere"></p>
				</div>
				<div class="ui-orderdetail mui-table-view">
					<div class="mui-table-view-cell">
						<p class="mui-icon FontAwesome icon-gift mui-pull-left" style="color: gray;"></p>
						<h5 class="mui-text-left" style="padding-left: 30px; color: black;font-weight: bold;">就想官方商城</h5>
					</div>
					<div class="orderGoods">
					<a class="mui-table-view-cell ui-good">
						<img class="ui-logo" src="123.jpg"/>
						<span style="display: inline-block;white-space: pre-wrap;width: 60%;font-size: 12px; vertical-align: top;">英国原装进口Lebay/丽贝拉拉裤6号XXL码20片超薄干爽透气学步裤全国包邮</span>
						<span style="display: inline-block; font-size: 12px;font-weight: bold; vertical-align: top;">¥{data} <br />*1</span>
					</a>
					</div>
					<div class="mui-table-view-cell">
						<p class="ui-fee">
							<span>商品小计:</span>
							<span id="goodprice">¥{data}</span>
						</p>
						<p class="ui-fee">
							<span>运费:</span>
							<span id="yunfee">¥{data}</span>
						</p>
						<p class="ui-fee">
							<span>合计(含运费):</span>
							<span id="sumfee">¥{data}</span>
						</p>
					</div>
				</div>
			</div>
		</div>
		<footer class="mui-button-row" style="position: fixed; right: 0; bottom: 0; z-index: 999;">
			<button type="button" class="mui-btn mui-btn-danger">
				关闭订单
			</button>
			<button type="button" class="mui-btn mui-btn-success">
				订单付款	
			</button>
		</footer>
		
		<script src="../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/config.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init();
			mui.plusReady(function(){
				ws = plus.webview.currentWebview();
				wo = ws.opener();
				ws.show();
				wo.evalJS('closeWaiting()');
				
				//读取数据
				getDetail(ws.c);
				
				
			});
			
			
			var getDetail = function(oid){
				
				mui.ajax(ipconfig().ip+'Order.getOrderDetail',{
					data:{'oid':oid},
					dataType:'json',
					timeout:10000,
					type:'get',
					headers:{'Content-type':'application/json'},
					success:function(data){
						if(data.data.code==0){
							loadDom(data.data.data);
						}
					},
					error:function(xhr,type,errorThrow){
						console.log(type);
					}
				});
				
				
			};
			
			var loadDom = function(data){
				var html = [];
				var ostatus = '';
				switch(data.order[0].status){
					case '-6':
					ostatus = '已退款';
					break;
					case '-5':
					ostatus = '已退货';
					break;
					case '-4':
					ostatus = '退货中';
					break;
					case '-3':
					ostatus = '换货中';
					break;
					case '-2':
					ostatus = '退款中';
					break;
					case '-1':
					ostatus = '取消订单';
					break;
					case '0':
					ostatus = '待付款';
					break;
					case '1':
					ostatus = '待发货';
					break;
					case '2':
					ostatus = '已发货';
					break;
					case '3':
					ostatus = '完成订单';
					break
					default :
					ostatus = '订单发生异常';
					break;
				}
				document.getElementById('ordersn').innerText = data.order[0].ordersn;
				document.getElementById('orderstatus').innerText = ostatus;
				document.getElementById('orderprice').innerText = data.order[0].price;
				document.getElementById('orderdisprice').innerText = data.order[0].dispatchprice;
				document.getElementById('toWho').innerText = data.order[0].address_realname;
				document.getElementById('callWhat').innerText = data.order[0].address_mobile;
				
				document.getElementById('goodprice').innerText = '¥ '+data.order[0].price;
				document.getElementById('yunfee').innerText = '¥ '+data.order[0].dispatchprice;
				document.getElementById('sumfee').innerText = '¥ '+(data.order[0].price+data.order[0].dispatchprice); 
				
				mui.each(data.goods,function(index,item){
					html.push('<a class="mui-table-view-cell ui-good"><img class="ui-logo" src="'+ipconfig().jpg+item.thumb+'"/><span style="display: inline-block;white-space: pre-wrap;width: 60%;font-size: 12px; vertical-align: top;">'+item.title+'</span><span style="display: inline-block; font-size: 12px;font-weight: bold; vertical-align: top;">¥'+item.price+' <br />*'+item.total+'</span></a>');
				});
				
				document.getElementsByClassName('orderGoods')[0].innerHTML = html.join("");
			};
			
		</script>
	</body>
</html>
